/**
 * 应收帐节点查询
 * zty
 * 2017-02-20
 */
(function () {
	var serverData = {};

    //查询
    jQuery('#search_btn').on('click',function(){
   	 var MonthYearDate = jQuery('#nian').val()+jQuery('#yue').val();//MonthAccountsReceivable存储过程参数存储过程为年月
   	 if(parseInt(jQuery('#yue').val())<10){
     	var MonthYearDate = (jQuery('#nian').val())+"0"+(parseInt(jQuery('#yue').val()));
     }else {
     	var MonthYearDate = (jQuery('#nian').val())+(parseInt(jQuery('#yue').val()));        	
     }
   	 if(parseInt(jQuery('#yue').val())==12){//MonthAccountsReceivableTQ存储过程参数年月日
     	  var ReceivableTQDate = (parseInt(jQuery('#nian').val())+1)+"-"+01+"-"+01;//年月日
     }else if(parseInt(jQuery('#yue').val())<10){
     	  var ReceivableTQDate = (jQuery('#nian').val())+"-0"+(parseInt(jQuery('#yue').val())+1)+"-"+01;
     }else{
   	  var ReceivableTQDate = (jQuery('#nian').val())+"-"+(parseInt(jQuery('#yue').val())+1)+"-"+01;
     }
        serverData.MonthYearDate=MonthYearDate;
        serverData.ReceivableTQDate=ReceivableTQDate;
        jQuery.ajax({
			type : 'get',
			url : window.rootPath + "/ui/paymentNode/getMyTrance",
			data : {
				'MonthYearDate': MonthYearDate,
				'ReceivableTQDate':ReceivableTQDate
			},
			dataType : 'json',
			contentType : 'application/json;charset=utf-8',
			success : function(data) {
				fuzhi(data);
			}
		});  	 
        
	});
	
    jQuery(document).ready(function () {
    	/*
    	 * 初始化
    	 */
    	var date = new Date();
    	//本月1日
    	var MonthYearDate = date.getFullYear()+(date.getMonth()+1);
    	//月份小余10，在前面加0
    	if(date.getMonth()+1 == 12){
    		//12月年+1；为明年1月1日
    		var ReceivableTQDate = (date.getFullYear()+1)+"-01-01";
    	}else{
    		var ReceivableTQDate = date.getFullYear()+"-"+(date.getMonth()+2)+"-01";
    	}
    	serverData.MonthYearDate=MonthYearDate	;
        serverData.ReceivableTQDate=ReceivableTQDate;
        
        var sel = document.getElementById('nian');
    	var date = new Date();
    	for(var j=2;j>=0;j--){
    		var opt = document.createElement('option');
    		opt.value = date.getFullYear()+j;
    		opt.innerHTML = date.getFullYear()+j;
    		sel.appendChild(opt);
    		if(j==0){
    			opt.selected="selected"
    		}
    	}
    	for(var i=0;i<6;i++)
    	{
    		var opt = document.createElement("option");
    		opt.value = (date.getFullYear()-i-1);
    		opt.innerHTML = (date.getFullYear()-i-1);
    		sel.appendChild(opt);
    	}
    	 /*
    	  * 获取月份
    	  */
    	var mm = document.getElementById('yue');
    	 for(var k=1;k<=12;k++){
    		 var opt = document.createElement("option");
     		opt.value = k;
     		opt.innerHTML = k;
    		mm.appendChild(opt);
    		if(date.getMonth()+1 == k){
     			opt.selected="selected"
     		}
    	 }
    	 
    	 var MonthYearDate = jQuery('#nian').val()+jQuery('#yue').val();//存储过程为年月
         //如果为12月，年进1
         if(parseInt(jQuery('#yue').val())<10){
         	var MonthYearDate = (jQuery('#nian').val())+"0"+(parseInt(jQuery('#yue').val()));
         }else{
         	var MonthYearDate = (jQuery('#nian').val())+(parseInt(jQuery('#yue').val()));
         	
         }
    	 if(parseInt(jQuery('#yue').val())==12){//MonthAccountsReceivableTQ存储过程参数年月日
          	  var ReceivableTQDate = (parseInt(jQuery('#nian').val())+1)+"-"+01+"-"+01;//年月日
          }else if(parseInt(jQuery('#yue').val())<10){
          	  var ReceivableTQDate = (jQuery('#nian').val())+"-0"+(parseInt(jQuery('#yue').val())+1)+"-"+01;
          }else{
        	  var ReceivableTQDate = (jQuery('#nian').val())+"-"+(parseInt(jQuery('#yue').val())+1)+"-"+01;
          }
         serverData.MonthYearDate=MonthYearDate;
         serverData.ReceivableTQDate=ReceivableTQDate;
       
			jQuery.ajax({
				type : 'get',
				url : window.rootPath + "/ui/paymentNode/getMyTrance",
				data : {
					'MonthYearDate': MonthYearDate,
					'ReceivableTQDate':ReceivableTQDate
				},
				dataType : 'json',
				contentType : 'application/json;charset=utf-8',
				success : function(data) {
					fuzhi(data);
				}
			});  	 
    });
    function fuzhi(data){
    	var nDQYSYFK = 0;
		var nDQYSJDK = 0;
		var nDQYSFHK = 0;
		var nDQYSYSK = 0;
		var nDQYSTSK = 0;
		var nDQYSZBK = 0;
		var nDQYSYF = 0;
		var nDQTotal = 0;
		var nWDQYSYFK = 0;
		var nWDQYSJDK = 0;
		var nWDQYSFHK = 0;
		var nWDQYSYSK = 0;
		var nWDQYSTSK = 0;
		var nWDQYSZBK = 0;
		var nWDQYSYF = 0;
		var nWDQTotal = 0;
		var nHJTotal = 0;
		
		var nDQYSYFK1 = 0;
		var nDQYSJDK1 = 0;
		var nDQYSFHK1 = 0;
		var nDQYSYSK1 = 0;
		var nDQYSTSK1 = 0;
		var nDQYSZBK1 = 0;
		var nDQYSYF1 = 0;
		var nDQTotal1 = 0;
		var nWDQYSYFK1 = 0;
		var nWDQYSJDK1 = 0;
		var nWDQYSFHK1 = 0;
		var nWDQYSYSK1 = 0;
		var nWDQYSTSK1 = 0;
		var nWDQYSZBK1 = 0;
		var nWDQYSYF1 = 0;
		var nWDQTotal1 = 0;
		var nHJTotal1 = 0;
		var nDQYSYFK2 = 0;
		var nDQYSJDK2 = 0;
		var nDQYSFHK2 = 0;
		var nDQYSYSK2 = 0;
		var nDQYSTSK2 = 0;
		var nDQYSZBK2 = 0;
		var nDQYSYF2 = 0;
		var nDQTotal2 = 0;
		var nWDQYSYFK2 = 0;
		var nWDQYSJDK2 = 0;
		var nWDQYSFHK2 = 0;
		var nWDQYSYSK2 = 0;
		var nWDQYSTSK2 = 0;
		var nWDQYSZBK2 = 0;
		var nWDQYSYF2 = 0;
		var nWDQTotal2 = 0;
		var nHJTotal2 = 0;
		var nDQYSYFK3 = 0;
		var nDQYSJDK3 = 0;
		var nDQYSFHK3 = 0;
		var nDQYSYSK3 = 0;
		var nDQYSTSK3 = 0;
		var nDQYSZBK3 = 0;
		var nDQYSYF3 = 0;
		var nDQTotal3 = 0;
		var nWDQYSYFK3 = 0;
		var nWDQYSJDK3 = 0;
		var nWDQYSFHK3 = 0;
		var nWDQYSYSK3 = 0;
		var nWDQYSTSK3 = 0;
		var nWDQYSZBK3 = 0;
		var nWDQYSYF3 = 0;
		var nWDQTotal3 = 0;
		var nHJTotal3 = 0;
		var nDQYSYFK4 = 0;
		var nDQYSJDK4 = 0;
		var nDQYSFHK4 = 0;
		var nDQYSYSK4 = 0;
		var nDQYSTSK4 = 0;
		var nDQYSZBK4 = 0;
		var nDQYSYF4 = 0;
		var nDQTotal4 = 0;
		var nWDQYSYFK4 = 0;
		var nWDQYSJDK4 = 0;
		var nWDQYSFHK4 = 0;
		var nWDQYSYSK4 = 0;
		var nWDQYSTSK4 = 0;
		var nWDQYSZBK4 = 0;
		var nWDQYSYF4 = 0;
		var nWDQTotal4 = 0;
		var nHJTotal4 = 0;
		var nDQYSYFK5 = 0;
		var nDQYSJDK5 = 0;
		var nDQYSFHK5 = 0;
		var nDQYSYSK5 = 0;
		var nDQYSTSK5 = 0;
		var nDQYSZBK5 = 0;
		var nDQYSYF5 = 0;
		var nDQTotal5 = 0;
		var nWDQYSYFK5 = 0;
		var nWDQYSJDK5 = 0;
		var nWDQYSFHK5 = 0;
		var nWDQYSYSK5 = 0;
		var nWDQYSTSK5 = 0;
		var nWDQYSZBK5 = 0;
		var nWDQYSYF5 = 0;
		var nWDQTotal5 = 0;
		var nHJTotal5 = 0;
    	var nWKPXSCZJ =0;
    	var nWKPXSCBJ =0;
        var nWKPCTCZJ =0;
        var nWKPCTCBJ =0;
        var nWKPWMCZJ =0;
        var nWKPWMCBJ =0;
        
        document.getElementById("nDQYSYFKSum").innerHTML = 0;
		document.getElementById("nDQYSJDKSum").innerHTML = 0;
		document.getElementById("nDQYSFHKSum").innerHTML = 0;
		document.getElementById("nDQYSYSKSum").innerHTML = 0;
		document.getElementById("nDQYSTSKSum").innerHTML = 0;
		document.getElementById("nDQYSZBKSum").innerHTML = 0;
		document.getElementById("nDQYSYFSum").innerHTML = 0;
		document.getElementById("nDQTotalSum").innerHTML =0 ;
		document.getElementById("nWDQYSYFKSum").innerHTML = 0;
		document.getElementById("nWDQYSJDKSum").innerHTML = 0;
		document.getElementById("nWDQYSFHKSum").innerHTML = 0;
		document.getElementById("nWDQYSYSKSum").innerHTML = 0;
		document.getElementById("nWDQYSTSKSum").innerHTML =0 ;
		document.getElementById("nWDQYSZBKSum").innerHTML =0;
		document.getElementById("nWDQYSYFSum").innerHTML = 0;
		document.getElementById("nWDQTotalSum").innerHTML =0 ;
		document.getElementById("nHJTotalSum").innerHTML =0 ;
		document.getElementById("nDQYSYFKSum1").innerHTML = 0;
		document.getElementById("nDQYSJDKSum1").innerHTML = 0;
		document.getElementById("nDQYSFHKSum1").innerHTML = 0;
		document.getElementById("nDQYSYSKSum1").innerHTML = 0;
		document.getElementById("nDQYSTSKSum1").innerHTML = 0;
		document.getElementById("nDQYSZBKSum1").innerHTML = 0;
		document.getElementById("nDQYSYFSum1").innerHTML = 0;
		document.getElementById("nDQTotalSum1").innerHTML =0 ;
		document.getElementById("nWDQYSYFKSum1").innerHTML = 0;
		document.getElementById("nWDQYSJDKSum1").innerHTML = 0;
		document.getElementById("nWDQYSFHKSum1").innerHTML = 0;
		document.getElementById("nWDQYSYSKSum1").innerHTML = 0;
		document.getElementById("nWDQYSTSKSum1").innerHTML =0 ;
		document.getElementById("nWDQYSZBKSum1").innerHTML =0;
		document.getElementById("nWDQYSYFSum1").innerHTML = 0;
		document.getElementById("nWDQTotalSum1").innerHTML =0 ;
		document.getElementById("nHJTotalSum1").innerHTML =0 ;
		document.getElementById("nDQYSYFKSum2").innerHTML = 0;
		document.getElementById("nDQYSJDKSum2").innerHTML = 0;
		document.getElementById("nDQYSFHKSum2").innerHTML = 0;
		document.getElementById("nDQYSYSKSum2").innerHTML = 0;
		document.getElementById("nDQYSTSKSum2").innerHTML = 0;
		document.getElementById("nDQYSZBKSum2").innerHTML = 0;
		document.getElementById("nDQYSYFSum2").innerHTML = 0;
		document.getElementById("nDQTotalSum2").innerHTML =0 ;
		document.getElementById("nWDQYSYFKSum2").innerHTML = 0;
		document.getElementById("nWDQYSJDKSum2").innerHTML = 0;
		document.getElementById("nWDQYSFHKSum2").innerHTML = 0;
		document.getElementById("nWDQYSYSKSum2").innerHTML = 0;
		document.getElementById("nWDQYSTSKSum2").innerHTML =0 ;
		document.getElementById("nWDQYSZBKSum2").innerHTML =0;
		document.getElementById("nWDQYSYFSum2").innerHTML = 0;
		document.getElementById("nWDQTotalSum2").innerHTML =0 ;
		document.getElementById("nHJTotalSum2").innerHTML =0 ;
		document.getElementById("nDQYSYFKSum3").innerHTML = 0;
		document.getElementById("nDQYSJDKSum3").innerHTML = 0;
		document.getElementById("nDQYSFHKSum3").innerHTML = 0;
		document.getElementById("nDQYSYSKSum3").innerHTML = 0;
		document.getElementById("nDQYSTSKSum3").innerHTML = 0;
		document.getElementById("nDQYSZBKSum3").innerHTML = 0;
		document.getElementById("nDQYSYFSum3").innerHTML = 0;
		document.getElementById("nDQTotalSum3").innerHTML =0 ;
		document.getElementById("nWDQYSYFKSum3").innerHTML = 0;
		document.getElementById("nWDQYSJDKSum3").innerHTML = 0;
		document.getElementById("nWDQYSFHKSum3").innerHTML = 0;
		document.getElementById("nWDQYSYSKSum3").innerHTML = 0;
		document.getElementById("nWDQYSTSKSum3").innerHTML =0 ;
		document.getElementById("nWDQYSZBKSum3").innerHTML =0;
		document.getElementById("nWDQYSYFSum3").innerHTML = 0;
		document.getElementById("nWDQTotalSum3").innerHTML =0 ;
		document.getElementById("nHJTotalSum3").innerHTML =0 ;
		document.getElementById("nDQYSYFKSum4").innerHTML = 0;
		document.getElementById("nDQYSJDKSum4").innerHTML = 0;
		document.getElementById("nDQYSFHKSum4").innerHTML = 0;
		document.getElementById("nDQYSYSKSum4").innerHTML = 0;
		document.getElementById("nDQYSTSKSum4").innerHTML = 0;
		document.getElementById("nDQYSZBKSum4").innerHTML = 0;
		document.getElementById("nDQYSYFSum4").innerHTML = 0;
		document.getElementById("nDQTotalSum4").innerHTML =0 ;
		document.getElementById("nWDQYSYFKSum4").innerHTML = 0;
		document.getElementById("nWDQYSJDKSum4").innerHTML = 0;
		document.getElementById("nWDQYSFHKSum4").innerHTML = 0;
		document.getElementById("nWDQYSYSKSum4").innerHTML = 0;
		document.getElementById("nWDQYSTSKSum4").innerHTML =0 ;
		document.getElementById("nWDQYSZBKSum4").innerHTML =0;
		document.getElementById("nWDQYSYFSum4").innerHTML = 0;
		document.getElementById("nWDQTotalSum4").innerHTML =0 ;
		document.getElementById("nHJTotalSum4").innerHTML =0 ;
		document.getElementById("nDQYSYFKSum5").innerHTML = 0;
		document.getElementById("nDQYSJDKSum5").innerHTML = 0;
		document.getElementById("nDQYSFHKSum5").innerHTML = 0;
		document.getElementById("nDQYSYSKSum5").innerHTML = 0;
		document.getElementById("nDQYSTSKSum5").innerHTML = 0;
		document.getElementById("nDQYSZBKSum5").innerHTML = 0;
		document.getElementById("nDQYSYFSum5").innerHTML = 0;
		document.getElementById("nDQTotalSum5").innerHTML =0 ;
		document.getElementById("nWDQYSYFKSum5").innerHTML = 0;
		document.getElementById("nWDQYSJDKSum5").innerHTML = 0;
		document.getElementById("nWDQYSFHKSum5").innerHTML = 0;
		document.getElementById("nWDQYSYSKSum5").innerHTML = 0;
		document.getElementById("nWDQYSTSKSum5").innerHTML =0 ;
		document.getElementById("nWDQYSZBKSum5").innerHTML =0;
		document.getElementById("nWDQYSYFSum5").innerHTML = 0;
		document.getElementById("nWDQTotalSum5").innerHTML =0 ;
		document.getElementById("nHJTotalSum5").innerHTML =0 ;
		document.getElementById("nWKPXSCZJSum").innerHTML = 0;
		document.getElementById("nWKPXSCBJSum").innerHTML = 0;
		document.getElementById("nWKPCTCZJSum").innerHTML = 0;
		document.getElementById("nWKPCTCBJSum").innerHTML = 0;
		document.getElementById("nWKPWMCZJSum").innerHTML = 0;
		document.getElementById("nWKPWMCBJSum").innerHTML = 0;
		document.getElementById("nDQYSYFKSum6").innerHTML = 0;
		document.getElementById("nDQYSJDKSum6").innerHTML = 0;
		document.getElementById("nDQYSFHKSum6").innerHTML = 0;
		document.getElementById("nDQYSYSKSum6").innerHTML = 0;
		document.getElementById("nDQYSTSKSum6").innerHTML = 0;//调试
		document.getElementById("nDQYSZBKSum6").innerHTML = 0;
		document.getElementById("nDQYSYFSum6").innerHTML = 0;
		document.getElementById("nDQTotalSum6").innerHTML = 0;//合计	
		document.getElementById("nWDQYSYFKSum6").innerHTML = 0;
		document.getElementById("nWDQYSJDKSum6").innerHTML = 0;
		document.getElementById("nWDQYSFHKSum6").innerHTML = 0;
		document.getElementById("nWDQYSYSKSum6").innerHTML = 0;
		document.getElementById("nWDQYSTSKSum6").innerHTML = 0;//调试
		document.getElementById("nWDQYSZBKSum6").innerHTML = 0;
		document.getElementById("nWDQYSYFSum6").innerHTML = 0;
		document.getElementById("nWDQTotalSum6").innerHTML = 0;//合计
		document.getElementById("nHJTotalSum6").innerHTML = 0;//总合计
		document.getElementById("nWKPTotalSum").innerHTML = 0;		
		//alert(data.users[0].nDQYSFHKSum);
		for(var i=0;i<data.users.length;i++){
			
			if(data.users[i].superior == '销售处' && data.users[i].contractType == '项目合同'){
				 nDQYSYFK = data.users[i].nDQYSYFKSum;//到期应收预付款
				 nDQYSJDK = data.users[i].nDQYSJDKSum;//到期应收进度款
				 nDQYSFHK = data.users[i].nDQYSFHKSum;//到期应收发货款
				 nDQYSYSK = data.users[i].nDQYSYSKSum;//到期应收验收款
				 nDQYSTSK = data.users[i].nDQYSTSKSum;//到期应收调试款
				 nDQYSZBK = data.users[i].nDQYSZBKSum;//到期应收质保金
				 nDQYSYF = data.users[i].nDQYSYFSum;//到期运费
				 nDQTotal =nDQYSYFK+nDQYSJDK+nDQYSFHK+nDQYSYSK+nDQYSTSK+nDQYSZBK+nDQYSYF;//到期合计
				 nWDQYSYFK = data.users[i].nWDQYSYFKSum;//未到期应收预付款
				 nWDQYSJDK = data.users[i].nWDQYSJDKSum;//未到期应收进度款
				 nWDQYSFHK = data.users[i].nWDQYSFHKSum;//未到期应收发货款
				 nWDQYSYSK = data.users[i].nWDQYSYSKSum;//未到期应收验收款
				 nWDQYSTSK = data.users[i].nWDQYSTSKSum;//未到期应收调试款
				 nWDQYSZBK = data.users[i].nWDQYSZBKSum;//未到期应收质保金
				 nWDQYSYF = data.users[i].nWDQYSYFSum;//未到期运费
				 nWDQTotal =nWDQYSYFK+nWDQYSJDK+nWDQYSFHK+nWDQYSYSK+nWDQYSTSK+nWDQYSZBK+nWDQYSYF;//未到期合计
				 nHJTotal =nDQTotal+nWDQTotal;//合计总数1
				
				
				document.getElementById("nDQYSYFKSum").innerHTML = nDQYSYFK;
				document.getElementById("nDQYSJDKSum").innerHTML = nDQYSJDK;
				document.getElementById("nDQYSFHKSum").innerHTML = nDQYSFHK;
				document.getElementById("nDQYSYSKSum").innerHTML = nDQYSYSK;
				document.getElementById("nDQYSTSKSum").innerHTML = nDQYSTSK;
				document.getElementById("nDQYSZBKSum").innerHTML = nDQYSZBK;
				document.getElementById("nDQYSYFSum").innerHTML = nDQYSYF;
				document.getElementById("nDQTotalSum").innerHTML = nDQTotal;
				
				
				document.getElementById("nWDQYSYFKSum").innerHTML = nWDQYSYFK;
				document.getElementById("nWDQYSJDKSum").innerHTML = nWDQYSJDK;
				document.getElementById("nWDQYSFHKSum").innerHTML = nWDQYSFHK;
				document.getElementById("nWDQYSYSKSum").innerHTML = nWDQYSYSK;
				document.getElementById("nWDQYSTSKSum").innerHTML = nWDQYSTSK;
				document.getElementById("nWDQYSZBKSum").innerHTML = nWDQYSZBK;
				document.getElementById("nWDQYSYFSum").innerHTML = nWDQYSYF;
				document.getElementById("nWDQTotalSum").innerHTML = nWDQTotal;
				document.getElementById("nHJTotalSum").innerHTML = nHJTotal;//合计总数
			}
			if(data.users[i].superior == '销售处' && data.users[i].contractType == '备件合同'){
				 nDQYSYFK1 = data.users[i].nDQYSYFKSum;//到期应收预付款
				 nDQYSJDK1 = data.users[i].nDQYSJDKSum;//到期应收进度款
				 nDQYSFHK1 = data.users[i].nDQYSFHKSum;//到期应收发货款
				 nDQYSYSK1 = data.users[i].nDQYSYSKSum;//到期应收验收款
				 nDQYSTSK1 = data.users[i].nDQYSTSKSum;//到期应收调试款
				 nDQYSZBK1 = data.users[i].nDQYSZBKSum;//到期应收质保金
				 nDQYSYF1 = data.users[i].nDQYSYFSum;//到期运费
				 nDQTotal1 =nDQYSYFK1+nDQYSJDK1+nDQYSFHK1+nDQYSYSK1+nDQYSTSK1+nDQYSZBK1+nDQYSYF1;//到期合计
				 nWDQYSYFK1 = data.users[i].nWDQYSYFKSum;//未到期应收预付款
				 nWDQYSJDK1 = data.users[i].nWDQYSJDKSum;//未到期应收进度款
				 nWDQYSFHK1 = data.users[i].nWDQYSFHKSum;//未到期应收发货款
				 nWDQYSYSK1 = data.users[i].nWDQYSYSKSum;//未到期应收验收款
				 nWDQYSTSK1 = data.users[i].nWDQYSTSKSum;//未到期应收调试款
				 nWDQYSZBK1 = data.users[i].nWDQYSZBKSum;//未到期应收质保金
				 nWDQYSYF1 = data.users[i].nWDQYSYFSum;//未到期运费
				 nWDQTotal1 =nWDQYSYFK1+nWDQYSJDK1+nWDQYSFHK1+nWDQYSYSK1+nWDQYSTSK1+nWDQYSZBK1+nWDQYSYF1;//未到期合计
				 nHJTotal1 =nDQTotal1+nWDQTotal1;//合计总数
				
				document.getElementById("nDQYSYFKSum1").innerHTML = nDQYSYFK1;
				document.getElementById("nDQYSJDKSum1").innerHTML = nDQYSJDK1;
				document.getElementById("nDQYSFHKSum1").innerHTML = nDQYSFHK1;
				document.getElementById("nDQYSYSKSum1").innerHTML = nDQYSYSK1;
				document.getElementById("nDQYSTSKSum1").innerHTML = nDQYSTSK1;
				document.getElementById("nDQYSZBKSum1").innerHTML = nDQYSZBK1;
				document.getElementById("nDQYSYFSum1").innerHTML = nDQYSYF1;
				document.getElementById("nDQTotalSum1").innerHTML = nDQTotal1;
				
				
				document.getElementById("nWDQYSYFKSum1").innerHTML = nWDQYSYFK1;
				document.getElementById("nWDQYSJDKSum1").innerHTML = nWDQYSJDK1;
				document.getElementById("nWDQYSFHKSum1").innerHTML = nWDQYSFHK1;
				document.getElementById("nWDQYSYSKSum1").innerHTML = nWDQYSYSK1;
				document.getElementById("nWDQYSTSKSum1").innerHTML = nWDQYSTSK1;
				document.getElementById("nWDQYSZBKSum1").innerHTML = nWDQYSZBK1;
				document.getElementById("nWDQYSYFSum1").innerHTML = nWDQYSYF1;
				document.getElementById("nWDQTotalSum1").innerHTML = nWDQTotal1;
				document.getElementById("nHJTotalSum1").innerHTML = nHJTotal1;//合计总数
			}
			if(data.users[i].superior == '成套处' && data.users[i].contractType == '项目合同'){
				 nDQYSYFK2 = data.users[i].nDQYSYFKSum;//到期应收预付款
				 nDQYSJDK2 = data.users[i].nDQYSJDKSum;//到期应收进度款
				 nDQYSFHK2 = data.users[i].nDQYSFHKSum;//到期应收发货款
				 nDQYSYSK2 = data.users[i].nDQYSYSKSum;//到期应收验收款
				 nDQYSTSK2 = data.users[i].nDQYSTSKSum;//到期应收调试款
				 nDQYSZBK2 = data.users[i].nDQYSZBKSum;//到期应收质保金
				 nDQYSYF2 = data.users[i].nDQYSYFSum;//到期运费
				 nDQTotal2 =nDQYSYFK2+nDQYSJDK2+nDQYSFHK2+nDQYSYSK2+nDQYSTSK2+nDQYSZBK2+nDQYSYF2;//到期合计
				 nWDQYSYFK2 = data.users[i].nWDQYSYFKSum;//未到期应收预付款
				 nWDQYSJDK2 = data.users[i].nWDQYSJDKSum;//未到期应收进度款
				 nWDQYSFHK2 = data.users[i].nWDQYSFHKSum;//未到期应收发货款
				 nWDQYSYSK2 = data.users[i].nWDQYSYSKSum;//未到期应收验收款
				 nWDQYSTSK2 = data.users[i].nWDQYSTSKSum;//未到期应收调试款
				 nWDQYSZBK2 = data.users[i].nWDQYSZBKSum;//未到期应收质保金
				 nWDQYSYF2 = data.users[i].nWDQYSYFSum;//未到期运费
				 nWDQTotal2 =nWDQYSYFK2+nWDQYSJDK2+nWDQYSFHK2+nWDQYSYSK2+nWDQYSTSK2+nWDQYSZBK2+nWDQYSYF2;//未到期合计
				 nHJTotal2 =nDQTotal2+nWDQTotal2;//合计总数
				
				document.getElementById("nDQYSYFKSum2").innerHTML = nDQYSYFK2;
				document.getElementById("nDQYSJDKSum2").innerHTML = nDQYSJDK2;
				document.getElementById("nDQYSFHKSum2").innerHTML = nDQYSFHK2;
				document.getElementById("nDQYSYSKSum2").innerHTML = nDQYSYSK2;
				document.getElementById("nDQYSTSKSum2").innerHTML = nDQYSTSK2;
				document.getElementById("nDQYSZBKSum2").innerHTML = nDQYSZBK2;
				document.getElementById("nDQYSYFSum2").innerHTML = nDQYSYF2;
				document.getElementById("nDQTotalSum2").innerHTML = nDQTotal2;
				
				
				document.getElementById("nWDQYSYFKSum2").innerHTML = nWDQYSYFK2;
				document.getElementById("nWDQYSJDKSum2").innerHTML = nWDQYSJDK2;
				document.getElementById("nWDQYSFHKSum2").innerHTML = nWDQYSFHK2;
				document.getElementById("nWDQYSYSKSum2").innerHTML = nWDQYSYSK2;
				document.getElementById("nWDQYSTSKSum2").innerHTML = nWDQYSTSK2;
				document.getElementById("nWDQYSZBKSum2").innerHTML = nWDQYSZBK2;
				document.getElementById("nWDQYSYFSum2").innerHTML = nWDQYSYF2;
				document.getElementById("nWDQTotalSum2").innerHTML = nWDQTotal2;
				document.getElementById("nHJTotalSum2").innerHTML = nHJTotal2;//合计总数
			}
			if(data.users[i].superior == '成套处' && data.users[i].contractType == '备件合同'){
				 nDQYSYFK3 = data.users[i].nDQYSYFKSum;//到期应收预付款
				 nDQYSJDK3 = data.users[i].nDQYSJDKSum;//到期应收进度款
				 nDQYSFHK3 = data.users[i].nDQYSFHKSum;//到期应收发货款
				 nDQYSYSK3 = data.users[i].nDQYSYSKSum;//到期应收验收款
				 nDQYSTSK3 = data.users[i].nDQYSTSKSum;//到期应收调试款
				 nDQYSZBK3 = data.users[i].nDQYSZBKSum;//到期应收质保金
				 nDQYSYF3 = data.users[i].nDQYSYFSum;//到期运费
				 nDQTotal3 =nDQYSYFK3+nDQYSJDK3+nDQYSFHK3+nDQYSYSK3+nDQYSTSK3+nDQYSZBK3+nDQYSYF3;//到期合计
				 nWDQYSYFK3 = data.users[i].nWDQYSYFKSum;//未到期应收预付款
				 nWDQYSJDK3 = data.users[i].nWDQYSJDKSum;//未到期应收进度款
				 nWDQYSFHK3 = data.users[i].nWDQYSFHKSum;//未到期应收发货款
				 nWDQYSYSK3 = data.users[i].nWDQYSYSKSum;//未到期应收验收款
				 nWDQYSTSK3 = data.users[i].nWDQYSTSKSum;//未到期应收调试款
				 nWDQYSZBK3 = data.users[i].nWDQYSZBKSum;//未到期应收质保金
				 nWDQYSYF3 = data.users[i].nWDQYSYFSum;//未到期运费
				 nWDQTotal3 =nWDQYSYFK3+nWDQYSJDK3+nWDQYSFHK3+nWDQYSYSK3+nWDQYSTSK3+nWDQYSZBK3+nWDQYSYF3;//未到期合计
				 nHJTotal3 =nDQTotal3+nWDQTotal3;//合计总数
				
				document.getElementById("nDQYSYFKSum3").innerHTML = nDQYSYFK3;
				document.getElementById("nDQYSJDKSum3").innerHTML = nDQYSJDK3;
				document.getElementById("nDQYSFHKSum3").innerHTML = nDQYSFHK3;
				document.getElementById("nDQYSYSKSum3").innerHTML = nDQYSYSK3;
				document.getElementById("nDQYSTSKSum3").innerHTML = nDQYSTSK3;
				document.getElementById("nDQYSZBKSum3").innerHTML = nDQYSZBK3;
				document.getElementById("nDQYSYFSum3").innerHTML = nDQYSYF3;
				document.getElementById("nDQTotalSum3").innerHTML = nDQTotal3;
				
				
				document.getElementById("nWDQYSYFKSum3").innerHTML = nWDQYSYFK3;
				document.getElementById("nWDQYSJDKSum3").innerHTML = nWDQYSJDK3;
				document.getElementById("nWDQYSFHKSum3").innerHTML = nWDQYSFHK3;
				document.getElementById("nWDQYSYSKSum3").innerHTML = nWDQYSYSK3;
				document.getElementById("nWDQYSTSKSum3").innerHTML = nWDQYSTSK3;
				document.getElementById("nWDQYSZBKSum3").innerHTML = nWDQYSZBK3;
				document.getElementById("nWDQYSYFSum3").innerHTML = nWDQYSYF3;
				document.getElementById("nWDQTotalSum3").innerHTML = nWDQTotal3;
				document.getElementById("nHJTotalSum3").innerHTML = nHJTotal3;//合计总数
			}
			if(data.users[i].superior == '外贸处' && data.users[i].contractType == '项目合同'){
				 nDQYSYFK4 = data.users[i].nDQYSYFKSum;//到期应收预付款
				 nDQYSJDK4 = data.users[i].nDQYSJDKSum;//到期应收进度款
				 nDQYSFHK4 = data.users[i].nDQYSFHKSum;//到期应收发货款
				 nDQYSYSK4 = data.users[i].nDQYSYSKSum;//到期应收验收款
				 nDQYSTSK4 = data.users[i].nDQYSTSKSum;//到期应收调试款
				 nDQYSZBK4 = data.users[i].nDQYSZBKSum;//到期应收质保金
				 nDQYSYF4 = data.users[i].nDQYSYFSum;//到期运费
				 nDQTotal4 =nDQYSYFK4+nDQYSJDK4+nDQYSFHK4+nDQYSYSK4+nDQYSTSK4+nDQYSZBK4+nDQYSYF4;//到期合计
				 nWDQYSYFK4 = data.users[i].nWDQYSYFKSum;//未到期应收预付款
				 nWDQYSJDK4 = data.users[i].nWDQYSJDKSum;//未到期应收进度款
				 nWDQYSFHK4 = data.users[i].nWDQYSFHKSum;//未到期应收发货款
				 nWDQYSYSK4 = data.users[i].nWDQYSYSKSum;//未到期应收验收款
				 nWDQYSTSK4 = data.users[i].nWDQYSTSKSum;//未到期应收调试款
				 nWDQYSZBK4 = data.users[i].nWDQYSZBKSum;//未到期应收质保金
				 nWDQYSYF4 = data.users[i].nWDQYSYFSum;//未到期运费
				 nWDQTotal4 =nWDQYSYFK4+nWDQYSJDK4+nWDQYSFHK4+nWDQYSYSK4+nWDQYSTSK4+nWDQYSZBK4+nWDQYSYF4;//未到期合计
				 nHJTotal4 =nDQTotal4+nWDQTotal4;//合计总数
				
				document.getElementById("nDQYSYFKSum4").innerHTML = nDQYSYFK4;
				document.getElementById("nDQYSJDKSum4").innerHTML = nDQYSJDK4;
				document.getElementById("nDQYSFHKSum4").innerHTML = nDQYSFHK4;
				document.getElementById("nDQYSYSKSum4").innerHTML = nDQYSYSK4;
				document.getElementById("nDQYSTSKSum4").innerHTML = nDQYSTSK4;
				document.getElementById("nDQYSZBKSum4").innerHTML = nDQYSZBK4;
				document.getElementById("nDQYSYFSum4").innerHTML = nDQYSYF4;
				document.getElementById("nDQTotalSum4").innerHTML = nDQTotal4;
				
				
				document.getElementById("nWDQYSYFKSum4").innerHTML = nWDQYSYFK4;
				document.getElementById("nWDQYSJDKSum4").innerHTML = nWDQYSJDK4;
				document.getElementById("nWDQYSFHKSum4").innerHTML = nWDQYSFHK4;
				document.getElementById("nWDQYSYSKSum4").innerHTML = nWDQYSYSK4;
				document.getElementById("nWDQYSTSKSum4").innerHTML = nWDQYSTSK4;
				document.getElementById("nWDQYSZBKSum4").innerHTML = nWDQYSZBK4;
				document.getElementById("nWDQYSYFSum4").innerHTML = nWDQYSYF4;
				document.getElementById("nWDQTotalSum4").innerHTML = nWDQTotal4;
				document.getElementById("nHJTotalSum4").innerHTML = nHJTotal4;//合计总数
			}
			if(data.users[i].superior == '外贸处' && data.users[i].contractType == '备件合同'){
				 nDQYSYFK5 = data.users[i].nDQYSYFKSum;//到期应收预付款
				 nDQYSJDK5 = data.users[i].nDQYSJDKSum;//到期应收进度款
				 nDQYSFHK5 = data.users[i].nDQYSFHKSum;//到期应收发货款
				 nDQYSYSK5 = data.users[i].nDQYSYSKSum;//到期应收验收款
				nDQYSTSK5 = data.users[i].nDQYSTSKSum;//到期应收调试款
				 nDQYSZBK5 = data.users[i].nDQYSZBKSum;//到期应收质保金
				 nDQYSYF5 = data.users[i].nDQYSYFSum;//到期运费
				 nDQTotal5 =nDQYSYFK5+nDQYSJDK5+nDQYSFHK5+nDQYSYSK5+nDQYSTSK5+nDQYSZBK5+nDQYSYF5;//到期合计
				 nWDQYSYFK5 = data.users[i].nWDQYSYFKSum;//未到期应收预付款
				 nWDQYSJDK5 = data.users[i].nWDQYSJDKSum;//未到期应收进度款
				 nWDQYSFHK5 = data.users[i].nWDQYSFHKSum;//未到期应收发货款
				 nWDQYSYSK5 = data.users[i].nWDQYSYSKSum;//未到期应收验收款
				 nWDQYSTSK5 = data.users[i].nWDQYSTSKSum;//未到期应收调试款
				 nWDQYSZBK5 = data.users[i].nWDQYSZBKSum;//未到期应收质保金
				 nWDQYSYF5 = data.users[i].nWDQYSYFSum;//未到期运费
				 nWDQTotal5 =nWDQYSYFK5+nWDQYSJDK5+nWDQYSFHK5+nWDQYSYSK5+nWDQYSTSK5+nWDQYSZBK5+nWDQYSYF5;//未到期合计
				 nHJTotal5 =nDQTotal5+nWDQTotal5;//合计总数
				
				document.getElementById("nDQYSYFKSum5").innerHTML = nDQYSYFK5;
				document.getElementById("nDQYSJDKSum5").innerHTML = nDQYSJDK5;
				document.getElementById("nDQYSFHKSum5").innerHTML = nDQYSFHK5;
				document.getElementById("nDQYSYSKSum5").innerHTML = nDQYSYSK5;
				document.getElementById("nDQYSTSKSum5").innerHTML = nDQYSTSK5;
				document.getElementById("nDQYSZBKSum5").innerHTML = nDQYSZBK5;
				document.getElementById("nDQYSYFSum5").innerHTML = nDQYSYF5;
				document.getElementById("nDQTotalSum5").innerHTML = nDQTotal5;
				
				
				document.getElementById("nWDQYSYFKSum5").innerHTML = nWDQYSYFK5;
				document.getElementById("nWDQYSJDKSum5").innerHTML = nWDQYSJDK5;
				document.getElementById("nWDQYSFHKSum5").innerHTML = nWDQYSFHK5;
				document.getElementById("nWDQYSYSKSum5").innerHTML = nWDQYSYSK5;
				document.getElementById("nWDQYSTSKSum5").innerHTML = nWDQYSTSK5;
				document.getElementById("nWDQYSZBKSum5").innerHTML = nWDQYSZBK5;
				document.getElementById("nWDQYSYFSum5").innerHTML = nWDQYSYF5;
				document.getElementById("nWDQTotalSum5").innerHTML = nWDQTotal5;
				document.getElementById("nHJTotalSum5").innerHTML = nHJTotal5;//合计总数
			}
			/*
			 * 合计
			 */
			
			var nDQYSYFKTotal = nDQYSYFK+nDQYSYFK1+nDQYSYFK2+nDQYSYFK3+nDQYSYFK4+nDQYSYFK5;//到期应收预付款合计
			var nDQYSYFKTotal1 = nDQYSJDK+nDQYSJDK1+nDQYSJDK2+nDQYSJDK3+nDQYSJDK4+nDQYSJDK5;//到期应收进度款合计
			var nDQYSYFKTotal2 = nDQYSFHK1+nDQYSFHK2+nDQYSFHK3+nDQYSFHK4+nDQYSFHK5+nDQYSFHK;//到期应收发货款合计
			var nDQYSYFKTotal3 = nDQYSYSK+nDQYSYSK1+nDQYSYSK2+nDQYSYSK3+nDQYSYSK4+nDQYSYSK5;//到期应收验收款合计
			var nDQYSYFKTotal4 = nDQYSTSK+nDQYSTSK1+nDQYSTSK2+nDQYSTSK3+nDQYSTSK4+nDQYSTSK5;//到期应收调试款合计
			var nDQYSYFKTotal5 = nDQYSZBK+nDQYSZBK1+nDQYSZBK2+nDQYSZBK3+nDQYSZBK4+nDQYSZBK5;//到期应收质保金合计
			var nDQYSYFKTotal6 = nDQYSYF+nDQYSYF1+nDQYSYF2+nDQYSYF3+nDQYSYF4+nDQYSYF5;//到期应收运费合计
			var nDQYSYFKTotal7 = nDQTotal+nDQTotal1+nDQTotal2+nDQTotal3+nDQTotal4+nDQTotal5;//到期应收合计
			
			var nWDQYSYFKTotal8 = nWDQYSYFK+nWDQYSYFK1+nWDQYSYFK2+nWDQYSYFK3+nWDQYSYFK4+nWDQYSYFK5;//未到期应收预付款合计
			var nWDQYSYFKTotal9 = nWDQYSJDK+nWDQYSJDK1+nWDQYSJDK2+nWDQYSJDK3+nWDQYSJDK4+nWDQYSJDK5;//未到期应收进度款合计
			var nWDQYSYFKTotal10 = nWDQYSFHK1+nWDQYSFHK2+nWDQYSFHK3+nWDQYSFHK4+nWDQYSFHK5+nWDQYSFHK;//未到期应收发货款合计
			var nWDQYSYFKTotal11 = nWDQYSYSK+nWDQYSYSK1+nWDQYSYSK2+nWDQYSYSK3+nWDQYSYSK4+nWDQYSYSK5;//未到期应收验收款合计
			var nWDQYSYFKTotal12 = nWDQYSTSK+nWDQYSTSK1+nWDQYSTSK2+nWDQYSTSK3+nWDQYSTSK4+nWDQYSTSK5;//未到期应收调试款合计
			var nWDQYSYFKTotal13 = nWDQYSZBK+nWDQYSZBK1+nWDQYSZBK2+nWDQYSZBK3+nWDQYSZBK4+nWDQYSZBK5;//未到期应收质保金合计
			var nWDQYSYFKTotal14 = nWDQYSYF+nWDQYSYF1+nWDQYSYF2+nWDQYSYF3+nWDQYSYF4+nWDQYSYF5;//未到期应收运费合计
			var nWDQYSYFKTotal15 = nWDQTotal+nWDQTotal1+nWDQTotal2+nWDQTotal3+nWDQTotal4+nWDQTotal5;//未到期应收合计
			var nHJTotal16 = nHJTotal+nHJTotal1+nHJTotal2+nHJTotal3+nHJTotal4+nHJTotal5;
			
			document.getElementById("nDQYSYFKSum6").innerHTML = nDQYSYFKTotal;
			document.getElementById("nDQYSJDKSum6").innerHTML = nDQYSYFKTotal1;
			document.getElementById("nDQYSFHKSum6").innerHTML = nDQYSYFKTotal2;
			document.getElementById("nDQYSYSKSum6").innerHTML = nDQYSYFKTotal3;
			document.getElementById("nDQYSTSKSum6").innerHTML = nDQYSYFKTotal4;//调试
			document.getElementById("nDQYSZBKSum6").innerHTML = nDQYSYFKTotal5;
			document.getElementById("nDQYSYFSum6").innerHTML = nDQYSYFKTotal6;
			document.getElementById("nDQTotalSum6").innerHTML = nDQYSYFKTotal7;//合计
			
			document.getElementById("nWDQYSYFKSum6").innerHTML = nWDQYSYFKTotal8;
			document.getElementById("nWDQYSJDKSum6").innerHTML = nWDQYSYFKTotal9;
			document.getElementById("nWDQYSFHKSum6").innerHTML = nWDQYSYFKTotal10;
			document.getElementById("nWDQYSYSKSum6").innerHTML = nWDQYSYFKTotal11;
			document.getElementById("nWDQYSTSKSum6").innerHTML = nWDQYSYFKTotal12;//调试
			document.getElementById("nWDQYSZBKSum6").innerHTML = nWDQYSYFKTotal13;
			document.getElementById("nWDQYSYFSum6").innerHTML = nWDQYSYFKTotal14;
			document.getElementById("nWDQTotalSum6").innerHTML = nWDQYSYFKTotal15;//合计
			document.getElementById("nHJTotalSum6").innerHTML = nHJTotal16;//总合计
			
			
		}
		/*
		 * 未开票
		 */
		
		for(var k=0;k<data.usersTQ.length;k++){
			if(data.usersTQ[k].superior == '销售处' && data.usersTQ[k].contractType == '项目合同'){
				 nWKPXSCZJ = data.usersTQ[k].nPaymentSum;//到期应收预付款
				document.getElementById("nWKPXSCZJSum").innerHTML = nWKPXSCZJ;
			}
			if(data.usersTQ[k].superior == '销售处' && data.usersTQ[k].contractType == '备件合同'){
				 nWKPXSCBJ = data.usersTQ[k].nPaymentSum;//到期应收预付款
				document.getElementById("nWKPXSCBJSum").innerHTML = nWKPXSCBJ;
			}
			if(data.usersTQ[k].superior == '成套处' && data.usersTQ[k].contractType == '项目合同'){
				 nWKPCTCZJ = data.usersTQ[k].nPaymentSum;//到期应收预付款
				document.getElementById("nWKPCTCBJSum").innerHTML = nWKPCTCZJ;
			}
			if(data.usersTQ[k].superior == '成套处' && data.usersTQ[k].contractType == '备件合同'){
				 nWKPCTCBJ = data.usersTQ[k].nPaymentSum;//到期应收预付款
				document.getElementById("nWKPCTCBJSum").innerHTML = nWKPCTCBJ;
			}
			if(data.usersTQ[k].superior == '外贸处' && data.usersTQ[k].contractType == '项目合同'){
				 nWKPWMCZJ = data.usersTQ[k].nPaymentSum;//到期应收预付款
				document.getElementById("nWKPWMCBJSum").innerHTML = nWKPWMCZJ;
			}
			if(data.usersTQ[k].superior == '外贸处' && data.usersTQ[k].contractType == '备件合同'){
				 nWKPWMCBJ = data.usersTQ[k].nPaymentSum;//到期应收预付款
				document.getElementById("nWKPWMCBJSum").innerHTML = nWKPWMCBJ;
			}
			
			var nWKPTotal = nWKPXSCZJ+nWKPXSCBJ+nWKPCTCZJ+nWKPCTCBJ+nWKPWMCZJ+nWKPWMCBJ;//未开票合计
			
			document.getElementById("nWKPTotalSum").innerHTML = nWKPTotal;		
		}
	
    }

})()